<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="/static/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/static/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="/static/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<link href="/static/lib/font-awesome/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="/static/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.min.js"></script>
<title>添加管理员</title>
<style>
select[multiple], select.form-control[multiple] {
    height: auto;
}
</style>
</head>
<body>
<div class="pd-20">
	<form action="/admin/article/update" method="post" class="form form-horizontal" id="form-admin-add">
		<input type="hidden" name="id"  value="${article.id}">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>文章标题：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="${article.title}" placeholder="" id="title" name="title" datatype="*2-26" nullmsg="标题不能为空" readonly="readonly">
			</div>
			<div class="col-5"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>类别：</label>
			<div class=" col-5">
				<span class="select-box" >
					<select name="cate" class="select" id="cateoption" datatype="*" nullmsg="类别不能为空">
					    <option value="">选择分类</option>
					      <%
					      	if(null!=categories!){
						      	for(cl in cateList!){
						      		var flag = 0;
						    		var clId = cl.id;
						    		  for( cates in categories!) { 
						    			if(cates.id==clId){
						    				flag=1;
						    				break;
						    			}
						    		}
						    		if(flag== 1){%>
							      			<option value="${cl.id}" selected="selected">${cl.name}</option>
							      		<%} else {%>
							      			<option value="${cl.id}">${cl.name}</option>
							      		<%}
							   }
					      	}else{
					      		for(cl in cateList!){%>
					    			<option value="${cl.id}">${cl.name}</option>
					    		<%}
					      	}%>
				</select></span>
			</div>
			<div class="col-5"> <span><a class="btn btn-primary radius" onclick="article_add('600','400','添加标签','/page/admin/article/category-add.html');"  href="javascript:;"><i class="icon-plus"></i> 新增类别</a></span></div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>状态：</label>
			<div class=" col-5">
				<span class="select-box" >
					<select name="status" class="select" id="status" datatype="*" nullmsg="状态不能为空">
					    <option value="1" <%if(1 == article.status!){%> selected="selected" <%}%> >发布</option>
					    <option value="0" <%if(0 == article.status!){%> selected="selected" <%}%> >草稿</option>
					    <option value="2" <%if(2 == article.status!){%> selected="selected" <%}%> >发布并置顶</option>
					
				</select></span>
			</div>
			<div class="col-5"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">正文：</label>
			<div class="formControls col-10">
				 <script id="content" name="content" type="text/plain" style="max-width:800px;height:500px;">${article.content}</script>
				<div style="display:none">${article.content}</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>选择标签：</label>
			<select name="tags" class="form-control col-8 " id="tagoption" multiple>
					    <option value="0">选择标签</option>
					    <%
						    if(null!=tags!){
						    	for(tl in tagList!){
						    		var flag = 0;
						    		var tlId = tl.id;
						    		for(tag in tags!){
						    			if(tag.id==tlId){
						    				flag=1;
						    				break;
						    			}
						    		}
						    		if(flag== 1){%>
						    			<option value="${tl.id}" selected="selected">${tl.name}</option>
						    		<%}else{%>
						    			<option value="${tl.id}">${tl.name}</option>
						    		<%}
						    	}
						    	
						    }else{
					    		for(tl in tagList!){%>
					    			<option value="${tl.id}">${tl.name}</option>
					    		<%}
					    	}%>
				</select>
			<div class="col-2"> <span><a class="btn btn-primary radius" onclick="article_add('600','400','添加标签','/page/admin/article/tag-add.html');"  href="javascript:;"><i class="icon-plus"></i> 新增标签</a></span></div>
		</div>
		<div class="row cl">
			<div class="col-10 col-offset-2">
				<button  class="btn btn-primary radius" type="submit" id="btnSubmit"><i class="Hui-iconfont"></i> 保存并提交</button>
				<button  class="btn btn-default radius" type="button" id="btnReset">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
	
</div>
<script type="text/javascript" src="/static/lib/jquery.min.js"></script> 
<script type="text/javascript" src="/static/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="/static/lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="/static/lib/layer2.1/layer.js"></script>
<script type="text/javascript" src="/static/js/H-ui.js"></script> 
<script type="text/javascript" src="/static/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/static/js/H-ui.admin.doc.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").Validform({
		btnSubmit:"#btnSubmit",
		btnReset:"#btnReset",
		ajaxPost:true,
		tiptype:2,
		callback:function(data){
			if(data.code!="1006"){
				layer.msg(data.description,{time: 1000, icon:6});
			}else{
				layer.msg(data.description,{time: 1000, icon:6});
				var index = parent.layer.getFrameIndex(window.name);
				parent.window.getDataList();
				parent.layer.close(index);
			}
			
		}
	}); 
});
//获取类别列表
function getCateList(){
	$.post("/admin/category/getAll", function(data){
		var $html  = $("#cateoption");
		$html.empty();
		$.each(data, function(index) {
			$html.append("<option value='"+this.id+"'>"+this.name+"</option>");
		});
		
	});
}
//获取标签列表
function getTagList(){
	$.post("/admin/tag/getAll", function(data){
		var $html  = $("#tagoption");
		$html.empty();
		$.each(data, function(index) {
			$html.append("<option value='"+this.id+"'>"+this.name+"</option>");
		});
		
	});
}
var content = UE.getEditor('content', {
	toolbars : [ [ 'anchor', // 锚点
	'bold', // 加粗
	'indent', // 首行缩进
	'italic', // 斜体
	'underline', // 下划线
	'strikethrough', // 删除线
	'subscript', // 下标
	'superscript', // 上标
	'formatmatch', // 格式刷
	'source', // 源代码
	'blockquote', // 引用
	'pasteplain', // 纯文本粘贴模式
	'selectall', // 全选
	'preview', // 预览
	'horizontal', // 分隔线
	'removeformat', // 清除格式
	'unlink', // 取消链接
	'deletecaption', // 删除表格标题
	'inserttitle', // 插入标题
	'fontfamily', // 字体
	'fontsize', // 字号
	'paragraph', // 段落格式
	'link', // 超链接
	'emotion', // 表情
	'searchreplace', // 查询替换
	'justifyleft', // 居左对齐
	'justifyright', // 居右对齐
	'justifycenter', // 居中对齐
	'justifyjustify', // 两端对齐
	'forecolor', // 字体颜色
	'backcolor', // 背景色
	'insertorderedlist', // 有序列表
	'insertunorderedlist', // 无序列表
	'fullscreen', // 全屏
	'directionalityltr', // 从左向右输入
	'directionalityrtl', // 从右向左输入
	'pagebreak', // 分页
	'imagecenter', // 居中
	'lineheight', // 行间距
	'edittip ', // 编辑提示
	'customstyle', // 自定义标题
	'autotypeset', // 自动排版
	'background', // 背景
	'inserttable', // 插入表格
	'insertimage', // 插入表格
	] ],
	autoHeightEnabled : true,
	autoFloatEnabled : true,
	initialFrameWidth:800, 
	initialFrameHeight : 400
});
</script>
</body>
</html>